/*
 * Created on 10/06/2006
 */
package jmine.tec.batch.event.domain;

import static jmine.tec.persist.schema.api.IndexOrder.ASC;

import javax.persistence.DiscriminatorValue;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;

import jmine.tec.batch.domain.Process;
import jmine.tec.persist.annotation.DiscriminatorComment;
import jmine.tec.persist.annotation.Index;

import org.hibernate.annotations.ForeignKey;

import bancosys.tec.component.Documentation;

/**
 * @author Frank Cara
 */
@Entity
@DiscriminatorValue(value = "PROCESS")
@DiscriminatorComment("EVENTO DE PROCESSO")
public class ProcessEvent extends Event {

    private Process process;

    /**
     * Construtor.
     */
    public ProcessEvent() {
        super();
    }

    /**
     * Construtor.
     * 
     * @param id id
     */
    public ProcessEvent(long id) {
        super(id);
    }

    /**
     * @return Retorna o processo.
     */
    @ManyToOne(fetch = FetchType.LAZY)
    @JoinColumn(name = "COD_PROCESS")
    @ForeignKey(name = "FK_PROC_EVENT")
    @Index(columns = "COD_PROCESS", suffix = "0", orders = ASC)
    @Documentation("CODIGO DO PROCESSO EXECUTADO.")
    public Process getProcess() {
        return this.process;
    }

    /**
     * Seta o processo desse evento.
     * 
     * @param process o processo do evento.
     */
    public void setProcess(Process process) {
        this.process = process;
    }

}
